<?php

namespace App\Http\Requests\Goods;

use App\Http\Requests\BasicFormRequests;

class GoodsRequest extends BasicFormRequests
{
    protected $rule = [
        'goods_name' => 'required',
        'goods_price' => 'required',
        'goods_show_image_id' => 'required',
        'goods_image_ids' => 'required',
        'goods_simple_name' => 'required',
        'goods_brand' => 'required',
        'belonging_works' => 'required',
        'sales_method'  => 'required',
        'goods_type_id' => 'required',
        'goods_describe' => 'required',
        'goods_stock' => 'required',
        'stock_status' => 'required'
    ];

    public function __construct(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null)
    {
        $this->message = [
            'goods_name.required' => trans('message.request_required', [
                'name' => trans('key.goods_name')
            ]),
            'goods_price.required' => trans('message.request_required', [
                'name' => trans('key.goods_price')
            ]),
            'goods_show_image_id.required' => trans('message.request_required', [
                'name' => trans('key.goods_show_image_id')
            ]),
            'goods_image_ids.required' => trans('message.request_required', [
                'name' => trans('key.goods_image_ids')
            ]),
            'goods_simple_name.required' => trans('message.request_required', [
                'name' => trans('key.goods_simple_name')
            ]),
            'goods_brand.required' => trans('message.request_required', [
                'name' => trans('key.goods_brand')
            ]),
            'belonging_works.required' => trans('message.request_required', [
                'name' => trans('key.belonging_works')
            ]),
            'sales_method.required' => trans('message.request_required', [
                'name' => trans('key.sales_method')
            ]),
            'goods_type_id.required' => trans('message.request_required', [
                'name' => trans('key.goods_type')
            ]),
            'goods_describe.required' => trans('message.request_required', [
                'name' => trans('key.goods_describe')
            ]),
            'goods_stock.required' => trans('message.request_required', [
                'name' => trans('key.goods_stock')
            ]),
            'stock_status.required' => trans('message.request_required', [
                'name' => trans('key.stock_status')
            ]),
        ];
        parent::__construct($query, $request, $attributes, $cookies, $files, $server, $content);
    }


    protected $scene = [
        'setPrice' => ['goods_price','goods_stock'],

    ];
}
